<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /**
     * @param int $status_code
     * @param array $data
     * @param string $message
     * @param array $errors
     * @return JsonResponse
     */
    public function response(int $status_code = 0, array $data = [], string $message = 'OK', array $errors = []): JsonResponse
    {
        return response()->json([
            'status_code'   =>  $status_code,
            'data'          =>  $data,
            'message'       =>  $message,
            'errors'        =>  $errors
        ]);
    }
}
